﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;

namespace MathLab.Messaging
{
    /// <summary>
    /// Common command literals used in system.
    /// </summary>
    static class Commands
    {
        public static string EXIT = "exit";
        public static string HELP = "help";
        public static Regex READ_FROM_FILE = new Regex(@"^read\(\w+(\.\w+)?\)$");
        public static Regex WRITE_TO_FILE = new Regex(@"^write\(\w+(\.\w+)+\)\[\w+(\ \w+)*\]$");

        public static Regex ARRAY_VIEW = new Regex(@"^\w+$");
        public static Regex ARRAY_CREATE = new Regex(@"^\w+=\[((-?\d+([,\.]\d+)?\s*)+;)*(-?\d+([,\.]\d+)?\s*)+;?\]$");
        public static Regex ARRAY_ADD_AND_SAVE = new Regex(@"^\w+=\w+\+\w+$");
        public static Regex ARRAY_ADD_AND_DISPLAY = new Regex(@"^\w+\+\w+$");
        public static Regex ARRAY_MULTIPLY_AND_SAVE = new Regex(@"^\w+=\w+\*\w+$");
        public static Regex ARRAY_MULTIPLY_AND_DISPLAY = new Regex(@"^\w+\*\w+$");
        public static Regex ARRAY_INVERSE_AND_SAVE = new Regex(@"^\w+=inv\(\w+\)$");
        public static Regex ARRAY_INVERSE_AND_DISPLAY = new Regex(@"^inv\(\w+\)$");
        public static Regex ARRAY_TRANSPOSE_AND_SAVE = new Regex(@"^\w+=transpose\(\w+\)$");
        public static Regex ARRAY_TRANSPOSE_AND_DISPLAY = new Regex(@"^transpose\(\w+\)$");
        public static Regex ARRAY_SCALAR_MULTIPLY_AND_SAVE_ARRAY_FIRST = new Regex(@"^\w+=\w+\*-?\d+([,\.]\d+)?$");
        public static Regex ARRAY_SCALAR_MULTIPLY_AND_DISPLAY_ARRAY_FIRST = new Regex(@"^\w+\*-?\d+([,\.]\d+)?$");
        public static Regex ARRAY_SCALAR_MULTIPLY_AND_SAVE_DIGIT_FIRST = new Regex(@"^\w+=-?\d+([,\.]\d+)?\*\w+$");
        public static Regex ARRAY_SCALAR_MULTIPLY_AND_DISPLAY_DIGIT_FIRST = new Regex(@"^-?\d+([,\.]\d+)?\*\w+$");
        public static Regex VECTOR_SCALAR_MULTIPLY_AND_SAVE = new Regex(@"^\w+=\w+\|\w+$");
        public static Regex VECTOR_SCALAR_MULTIPLY_AND_DISPLAY = new Regex(@"^\w+\|\w+$");
    }
}